﻿using System.Linq;
using Castle.DynamicProxy;

namespace Extensions.Interceptor.Cache.Keys;

public class MethodParameterStrategy:BaseStrategy
{
    public override KeyStrategyEnum KeyStrategyEnum { get; set; } = KeyStrategyEnum.MethodParameter;
    public override string GetKey(IInvocation invocation)
    {
        var parameters =  invocation.Arguments.Where(p=>ValidateValueType(p.GetType())).Select(p => p.ToString());
        return string.Join("", parameters);
    }
}